<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head th:replace="~{common::header('物资信息')}"></head>
<body>
<div class="container-fluid">
    <div class="row clearfix">
        <div class="col-md-12 column" style="text-align: center">
            <h3>
                物资信息
            </h3>
        </div>
    </div>

    <div class="row clearfix">
        <div class="col-md-12 column">
            <hr>
        </div>
        <div class="col-md-12 column">
            <div class="col-sm-4 col-md-3 column form-inline">
                <label for="a1">产品编码:</label>
                <input type="email" class="form-control" id="a1" placeholder="产品编码">
            </div>
            <div class="col-sm-4 col-md-3 column form-inline">
                <label for="a2">产品名称:</label>
                <input type="email" class="form-control" id="a2" placeholder="产品名称">
            </div>
            <div class="col-sm-4 col-md-3 column form-inline">
                <label for="a3">产品类型:</label>
                <input type="email" class="form-control" id="a3" placeholder="产品类型">
            </div>
            <div class="col-sm-12 col-md-3 column" >
                <button type="button" class="btn btn-primary" onclick="btn2()" style="margin-right: 10px">搜索</button>
                <button type="button" class="btn btn-primary" onclick="btn3()" >重置</button>
            </div>

        </div>
    </div>

    <div class="row clearfix" style="padding-top:10px ">
        <div class="row clearfix">
            <div class="col-md-12 column">
                <div class="col-md-12 column" style="overflow: hidden">
                    <table id="dg" class="easyui-datagrid"
                           data-options="
								  	pageSize:'20',
								  	pageList:[20,30,40,50],
									rownumbers:true,
									pagination:true,
									url:'/material/findMaterialPage',
									method:'get',
									width:'100%'">
                        <thead>
                        <tr>
                            <th data-options="field:'ck',checkbox: true">Item ID(15%)</th>
                            <th data-options="field:'id'" hidden>Item ID(15%)</th>
                            <th data-options="field:'materialNum',width:'48%'">物资编码</th>
                            <th data-options="field:'materialName',width:'48%'">物资名称</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>

            <div class="col-md-12 column">
                <div class="col-md-12 column" style="padding-top:10px;text-align:right">
                    <button type="button" onclick="topFunction()" id="myBtn" class="btn btn-primary" >返回顶部</button>
                    <button type="button" onclick="bnt5()"  class="btn btn-primary" >添加</button>
                </div>
            </div>
        </div>
    </div>
</div>



<script th:inline="none">


    //子窗口添加数据到父窗口
    var bnt5=function(){
        window.opener.bnt10($('#dg').datagrid('getSelections'));
    }

    //重置
    var btn3=function(){
        $("#a1").val("");
        $("#a2").val("");
        $("#a3").val("");
    }

    //模糊查询
    var btn2=function (){
        var a1=$("#a1").val();
        var a2=$("#a2").val();
        var a3=$("#a3").val();
        $('#dg').datagrid({
            url:'/material/findMaterialPage',
            method:'get',
            queryParams: {
                MaterialName:a2,
                MaterialType:a3,
                MaterialNum:a1
            }
        });
    }



















    //返回顶部
    // window.onscroll = function() {scrollFunction()};
    //
    // function scrollFunction() {console.log(121);
    //     if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
    //         document.getElementById("myBtn").style.display = "block";
    //     } else {
    //         document.getElementById("myBtn").style.display = "none";
    //     }
    // }
    //
    // // 点击按钮，返回顶部
    // function topFunction() {
    //     document.body.scrollTop = 0;
    //     document.documentElement.scrollTop = 0;
    // }
</script>
</body>
</html>